package net.pimpas.report.processor.condition.impl;

import net.pimpas.report.processor.condition.AbstractCondition;
import net.pimpas.report.processor.condition.ConditionType;
import net.pimpas.report.processor.exception.ConditionException;
import net.pimpas.report.processor.field.Field;
import net.pimpas.report.processor.resolver.FieldPropertyResolver;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;

public class GreaterThanCondition extends AbstractCondition {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1545847188241953232L;

	public GreaterThanCondition(Field field, Object value) {
		super(field, ConditionType.GREATER_THAN);
		this.setValue(value);
	}

	private Object value;

	@Override
	public Criterion process(String fieldAlias, FieldPropertyResolver resolver) throws ConditionException {
		return Restrictions.gt(fieldAlias, this.getValue());
	}

	public Object getValue() {
		return value;
	}

	public void setValue(Object value) {
		this.value = value;
	}
}